package com.syqc.monitor.ui.carsmonitor

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.syqc.comlib.utils.loadStringError
import com.syqc.comlib.utils.sub
import com.syqc.maps.clusters.ClusterItem
import com.syqc.monitor.R

class CarAdapter : BaseQuickAdapter<ClusterItem, BaseViewHolder>(R.layout.item_car) {
    var isPlate = false
    override fun convert(holder: BaseViewHolder, item: ClusterItem) {
        holder.getView<ImageView>(R.id.ivLogo).loadStringError(context, item.iconLink)
        val desc = if (isPlate) item.plate else item.name
        holder.setText(R.id.tvPlate, sub(desc, 9))
    }
}